package com.ruoyi.hospital.service.member.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hospital.mapper.member.MemberCollectMapper;
import com.ruoyi.hospital.domain.member.MemberCollect;
import com.ruoyi.hospital.service.member.IMemberCollectService;

/**
 * 用户收藏Service业务层处理
 * 
 * @author wendao
 * @date 2024-09-29
 */
@Service
public class MemberCollectServiceImpl implements IMemberCollectService 
{
    @Autowired
    private MemberCollectMapper memberCollectMapper;

    /**
     * 查询用户收藏
     * 
     * @param id 用户收藏主键
     * @return 用户收藏
     */
    @Override
    public MemberCollect selectMemberCollectById(Long id)
    {
        return memberCollectMapper.selectMemberCollectById(id);
    }

    /**
     * 查询用户收藏列表
     * 
     * @param memberCollect 用户收藏
     * @return 用户收藏
     */
    @Override
    public List<MemberCollect> selectMemberCollectList(MemberCollect memberCollect)
    {
        return memberCollectMapper.selectMemberCollectList(memberCollect);
    }

    /**
     * 新增用户收藏
     * 
     * @param memberCollect 用户收藏
     * @return 结果
     */
    @Override
    public int insertMemberCollect(MemberCollect memberCollect)
    {
        memberCollect.setCreateTime(DateUtils.getNowTimeSecond());
        return memberCollectMapper.insertMemberCollect(memberCollect);
    }

    /**
     * 修改用户收藏
     * 
     * @param memberCollect 用户收藏
     * @return 结果
     */
    @Override
    public int updateMemberCollect(MemberCollect memberCollect)
    {
        memberCollect.setUpdateTime(DateUtils.getNowTimeSecond());
        return memberCollectMapper.updateMemberCollect(memberCollect);
    }

    /**
     * 批量删除用户收藏
     * 
     * @param ids 需要删除的用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteMemberCollectByIds(Long[] ids)
    {
        return memberCollectMapper.deleteMemberCollectByIds(ids);
    }

    /**
     * 删除用户收藏信息
     * 
     * @param id 用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteMemberCollectById(Long id)
    {
        return memberCollectMapper.deleteMemberCollectById(id);
    }

    @Override
    public int deleteByMemberId(Integer collectId, Integer memberId) {
        return memberCollectMapper.deleteByMemberId(collectId,memberId);
    }
}
